import { get, post, put, del, getWithArgs } from '../utils/xFetch2'
// import axios from 'axios'

const jobAPI = {

    jobs: params => {
        return getWithArgs('api/v1/jobs/list', params)
    },
    jobDetail: ({jobId}) => {
        return getWithArgs(`api/v1/job/${jobId}/details`)
    },
    jobCity: params => {
        return getWithArgs('api/v1/job/city',params)
    },
    jobsByComp: params => {
        return getWithArgs('api/v1/jobs',params)
    },
    jobsAdmin: params => {
        return getWithArgs('api/v1/admin/jobs',params)
    },
    jobCreate: params => {
        return post("api/v1/job",params)
    },
    jobUpdate: (jobId, form) => {
        return put(`api/v1/job/${jobId}/update`,form)
    },
    jobDelete: (jobId) => {
        return del(`api/v1/job/${jobId}`)
    },
    jobClose: (jobId) => {
        return put(`api/v1/job/${jobId}/close`)
    },
    jobOpen: (jobId) => {
        return put(`api/v1/job/${jobId}/open`)
    },
    jobApprove: (jobId) => {
        return put(`api/v1/job/${jobId}`)
    },
    send: ({jobId}) => {
        return post(`api/v1/job/${jobId}/send`)
    },
    getCV: (param) => {
        return getWithArgs(`api/v1/jobSend`,param)
    },
    getRotation: (param) => {
        return getWithArgs(`api/v1/rotation`,param)
    },
}

export default jobAPI
